package com.wonderful.eyepetizer.data.entity.response

/**
 * Desc:
 * @Author: wonderful
 * @Time: 2024/1/23 16:13
 */
data class Resource<T>(val status: Int, val data: T?, val msg: String?, val code: Int? = null) {
    companion object {
        const val SUCCESS = 0
        const val ERROR = 1

        fun <T> success(data: T) = Resource(SUCCESS, data, null)

        fun <T> error(msg: String, code: Int?) = Resource<T>(ERROR, null, msg = msg, code = code)
    }
}